Ext.define('Jason.view.protal.dashboard.DashboardViewModel',{
	extend: 'Ext.app.ViewModel',
    alias: 'viewmodel.dashboard',
	stores : {
		timelineStore: {
			xtype : 'store',
            fields: [
                {name: '_id'},
                {name: 'name'},
                {name: 'content'},
                {name: 'date',type: 'date'},
                {name: 'userId'},
                {name: 'notificationType'}
            ],
			data: [
				/*{
					"_id": 642,
					"name": "Marion Williams",
					"content": ".",
					"date": "2015/08/23 20:45:00",
					"userId": 6,
					"notificationType": "image_sharing"
				},
				{
					"_id": 351,
					"name": "Nora Watson",
					"content": ".",
					"date": "2015/08/23 19:15:00",
					"userId": 7,
					"notificationType": "job_meeting"
				},{
					"_id": 553,
					"name": "捷森科技",
					"content": "初始化项目",
					"date": "2018/03/01 18:10:00",
					"userId": 8,
					"notificationType": "comment_reply"
				},
				{
					"_id": 232,
					"name": "Marion Brooks",
					"content": ".",
					"date": "2015/08/23 16:00:00",
					"userId": 9,
					"notificationType": "new_follower"
				},
				//------------------- YESTERDAY ---------------------
				{
					"_id": 775,
					"name": "Nettie Stewart",
					"content": ".",
					"date": "2015/08/22 18:40:00",
					"userId": 12,
					"notificationType": "comment"
				},
				{
					"_id": 247,
					"name": "Beatrice Carter",
					"content": ".",
					"date": "2015/08/22 13:30:00",
					"userId": 14,
					"notificationType": "like"
				}*/
				{
					"_id": 4,
					"name": "捷森科技",
					"content": "项目Pace插件监听系统加载状态",
					"date": "2018/03/06 13:48:00",
					"userId": 8,
					"notificationType": "job_meeting"
				},{
					"_id": 3,
					"name": "捷森科技",
					"content": "项目添加事例代码",
					"date": "2018/03/04 10:10:00",
					"userId": 8,
					"notificationType": "job_meeting"
				},{
					"_id": 2,
					"name": "捷森科技",
					"content": "项目添加package包封装框代码，集成第三方代码",
					"date": "2018/03/02 14:10:00",
					"userId": 8,
					"notificationType": "job_meeting"
				},{
					"_id": 1,
					"name": "捷森科技",
					"content": "初始化项目",
					"date": "2018/03/01 10:10:00",
					"userId": 8,
					"notificationType": "job_meeting"
				}
			]
		}
	},
	data:{
        pieChartOption:{
            title : {
                text: '某站点用户访问来源',
                subtext: '纯属虚构',
                x:'center'
            },
            tooltip : {
                trigger: 'item',
                formatter: "{a} <br/>{b} : {c} ({d}%)"
            },
            legend: {
                orient: 'vertical',
                left: 'left',
                data: ['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
            },
            series : [
                {
                    name: '访问来源',
                    type: 'pie',
                    radius : '55%',
                    center: ['50%', '60%'],
                    data:[
                        {
                            value:335,
                            name:'直接访问',
                            tooltip:"直接访问：\<br/\>用户：测试\<br/\>数量：335"
                        },
                        {
                            value:310,
                            name:'邮件营销',
                            tooltip:"邮件营销：\<br/\>测试"
                        },
                        {value:234, name:'联盟广告'},
                        {value:135, name:'视频广告'},
                        {value:1548, name:'搜索引擎'}
                    ],
                    itemStyle: {
                        emphasis: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        },
        funnelChartOption:{
            title: {
                text: '漏斗图',
                subtext: '纯属虚构',
                left: 'left',
                top: 'bottom'
            },
            tooltip: {
                trigger: 'item',
                formatter: "{a} <br/>{b} : {c}%"
            },
            toolbox: {
                orient: 'vertical',
                top: 'center',
                feature: {
                    dataView: {readOnly: false},
                    restore: {},
                    saveAsImage: {}
                }
            },
            legend: {
                orient: 'vertical',
                left: 'left',
                data: ['展现','点击','访问','咨询','订单']
            },
            calculable: true,
            series: [
                {
                    name: '漏斗图',
                    type: 'funnel',
                    width: '40%',
                    height: '45%',
                    left: '5%',
                    top: '50%',
                    data:[
                        {value: 60, name:'访问'},
                        {value: 30, name:'咨询'},
                        {value: 10, name:'订单'},
                        {value: 80, name:'点击'},
                        {value: 100, name:'展现'}
                    ]
                },
                {
                    name: '金字塔',
                    type: 'funnel',
                    width: '40%',
                    height: '45%',
                    left: '5%',
                    top: '5%',
                    sort: 'ascending',
                    data:[
                        {value: 60, name:'访问'},
                        {value: 30, name:'咨询'},
                        {value: 10, name:'订单'},
                        {value: 80, name:'点击'},
                        {value: 100, name:'展现'}
                    ]
                },
                {
                    name: '漏斗图',
                    type:'funnel',
                    width: '40%',
                    height: '45%',
                    left: '55%',
                    top: '5%',
                    label: {
                        normal: {
                            position: 'left'
                        }
                    },
                    data:[
                        {value: 60, name: '访问'},
                        {value: 30, name: '咨询'},
                        {value: 10, name: '订单'},
                        {value: 80, name: '点击'},
                        {value: 100, name: '展现'}
                    ]
                },
                {
                    name: '金字塔',
                    type:'funnel',
                    width: '40%',
                    height: '45%',
                    left: '55%',
                    top: '50%',
                    sort: 'ascending',
                    label: {
                        normal: {
                            position: 'left'
                        }
                    },
                    data:[
                        {value: 60, name: '访问'},
                        {value: 30, name: '咨询'},
                        {value: 10, name: '订单'},
                        {value: 80, name: '点击'},
                        {value: 100, name: '展现'}
                    ]
                }
            ]
        },
        funnelChart:{
            tooltip : {
                trigger: 'axis'
            },
            legend: {
                data:['投保人数','月新增人数','月新减人数']
            },
            toolbox: {
                show : true,
                feature : {
                    mark : {show: true},
                    dataView : {show: true, readOnly: false},
                    magicType : {show: true, type: ['line', 'bar', 'stack', 'tiled']},
                    restore : {show: true},
                    saveAsImage : {show: true}
                }
            },
            calculable : true,
            xAxis : [
                {
                    type : 'category',
                    boundaryGap : false,
                    data : ['2016-09','2016-10','2016-11','2016-12','2017-01','2017-02','2017-03','2017-04','2017-05','2017-06','2017-07','2017-08']
                }
            ],
            yAxis : [
                {
                    type : 'value'
                }
            ],
            series : [
                {
                    name:'投保人数',
                    type:'line',
                    stack: '总量',
                    itemStyle : { normal: {label : {show: true, position: 'top'}}},
                    data:[120, 132, 101, 134, 90, 230, 210]
                },
                {
                    name:'月新增人数',
                    type:'line',
                    stack: '总量',
                    itemStyle : { normal: {label : {show: true, position: 'top'}}},
                    data:[220, 182, 191, 234, 290, 330, 310]
                },
                {
                    name:'月新减人数',
                    type:'line',
                    stack: '总量',
                    itemStyle : { normal: {label : {show: true, position: 'top'}}},
                    data:[150, 232, 201, 154, 190, 330, 410]
                }
            ]
      },
        histogram:{
            title : {
                text: '某地区蒸发量和降水量',
                subtext: '纯属虚构'
            },
            tooltip : {
                trigger: 'axis'
            },
            legend: {
                data:['账单总额']
            },
            toolbox: {
                show : true,
                feature : {
                    mark : {show: true},
                    dataView : {show: true, readOnly: false},
                    magicType : {show: true, type: ['line', 'bar']},
                    restore : {show: true},
                    saveAsImage : {show: true}
                }
            },
            calculable : true,
            xAxis : [
                {
                    type : 'category',
                    data : ['2016-09','2016-10','2016-11','2016-12','2017-01','2017-02','2017-03','2017-04','2017-05','2017-06','2017-07','2017-08']
                }
            ],
            yAxis : [
                {
                    type : 'value'
                }
            ],
            series : [
                {
                    name:'账单总额',
                    type:'bar',
                    itemStyle : { normal: {label : {show: true, position: 'top'}}},
                    data:[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
                }
            ]
        }
    }
});